<?php

namespace services\task;

use Yii;
use common\components\Service;
use common\models\task\TaskRemind;

/**
 * Class TaskRemindService
 * @package services\task
 */
class TaskRemindService extends Service
{
    /**
     * 任务提醒信息
     *
     * @param int $taskId
     * @return array
     */
    public function getInfo(int $taskId = 0): array
    {
        $taskRemind = TaskRemind::findOne(['task_id' => $taskId]);
        $content = [];
        if ($taskRemind) {
            $content = $taskRemind->content;
        }

        return [
            'task_id' => $taskRemind->task_id ?? 0,
            'access_token' => $taskRemind->access_token ?? '',
            'secret' => $taskRemind->secret ?? '',
//            'content' => $taskRemind->content ?? '',
            'content' => $content,
        ];
    }
}
